{% if DEFAULT_PAGINATION %}
<nav class="navigation pagination">
  <h2 class="screen-reader-text">{{ _('Navegación de entradas') }}</h2>
  <div class="nav-links">
    {% if articles_page.has_previous() %}
    <a accesskey="A" class="prev page-numbers" href="{{ SITEURL }}/{{ articles_previous_page.url }}">{{ _('Página anterior') }}</a>
    {% endif %}

    {% for num in range(1, 1 + articles_paginator.num_pages) %}
      {% set print_number = False %}
      {% set dots_before = True %}
      {% if num == 1 %}
        {% set print_number = True %}
        {% set dots_before = False %}
      {% elif (articles_page.number - PAGINATOR_LIMIT / 2) <= num < (articles_page.number - PAGINATOR_LIMIT / 2 + 1) %}
        {% set print_number = True %}
        {% if num == 2 %}
          {% set dots_before = False %}
        {% endif %}
      {% elif (articles_page.number - PAGINATOR_LIMIT / 2 + 1) <= num <= (articles_page.number + PAGINATOR_LIMIT / 2) %}
        {% set print_number = True %}
        {% set dots_before = False %}
      {% elif num == articles_paginator.num_pages %}
        {% set print_number = True %}
        {% if (articles_page.number + PAGINATOR_LIMIT / 2) <= num <= (articles_page.number + PAGINATOR_LIMIT / 2 + 1)%}
          {% set dots_before = False %}
        {% endif %}
      {% endif %}

      {% if print_number %}
        {% if dots_before %}
          <span class="page-number-dots">...</span>
        {% endif %}
        {% if num == articles_page.number %}
          <span class="page-numbers current">
            <span class="meta-nav screen-reader-text">{{ _('Página') }}</span>
            {{ num }}
          </span>
        {% else %}
        <a class="page-numbers" href="{{ SITEURL }}/{{ articles_paginator.page(num).url }}">
            <span class="meta-nav screen-reader-text">{{ _('Página') }}</span>
            {{ num }}
          </a>
        {% endif %}
      {% endif %}

    {% endfor %}

    {% if articles_page.has_next() %}
    <a accesskey="S" class="next page-numbers" href="{{ SITEURL }}/{{ articles_next_page.url }}">{{ _('Página siguiente') }}</a>
    {% endif %}
  </div>
</nav>
{% endif %}
